<?php


namespace app\common\lib;


class Show
{
    public static function success($data = [], $msg = '')
    {
        return self::response(__FUNCTION__, $data, $msg);
    }


    public static function error($data = [], $msg = '')
    {
        return self::response(__FUNCTION__, $data, $msg);
    }

    public static function response($funcName = 'error', $data = [], $msg = '')
    {
        $status = $funcName == 'error' ? 2 : 1;

        return response(json_encode([
            'data' => $data,
            'msg' => $msg,
            'status' => $status,
        ], JSON_UNESCAPED_UNICODE));
    }
}